package cn.buk.tms.entity.misc;

import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

/**
 * Created with IntelliJ IDEA.
 * User: yfdai
 * Date: 13-7-29
 * Time: 下午3:29
 * To change this template use File | Settings | File Templates.
 * @author yfdai
 */
@Entity
@Table(name="history_amount")
public class AmountHistory {

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private  int id;

    @Column(name="owner_id")
    private Integer ownerId;

    @Column(name="enterprise_id")
    private int enterpriseId;

    @Column(name="user_id")
    private int userId;

    /**
     * 存入
     */
    private int credit;

    /**
     * 支出
     */
    private int debt;

    /**
     * 账户余额,冗余字段,方便查看
     */
    @Column(name = "account_balance")
    private Integer accountBalance;

    /**
     *        消费类别, 暂时无用
     */
    private int spendingType = 0;

    /**
     * 订单类型
     * 1 - 大客户订单
     * 2 -大客户退票
     * 3 - 大客户改签
     * 10 - 积分
     * 20 - 度假订单
     * 30 - 机票订单
     * 40 - 收款单
     * 50 - 产品购买
     * 100-系统调整
     */
    @Column(name = "order_type")
    private Integer orderType;

    @Column(name = "order_id")
    private Integer orderId;

    private String remark;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getCredit() {
        return credit;
    }

    public void setCredit(int credit) {
        this.credit = credit;
    }

    public int getDebt() {
        return debt;
    }

    public void setDebt(int debt) {
        this.debt = debt;
    }

    public int getSpendingType() {
        return spendingType;
    }

    public void setSpendingType(int spendingType) {
        this.spendingType = spendingType;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        if (orderType == null) {
            orderType = 0;
        }

        this.orderType = orderType;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        if (orderId == null) {
            orderId = 0;
        }

        this.orderId = orderId;
    }

    public Integer getAccountBalance() {
        return accountBalance;
    }

    public void setAccountBalance(Integer accountBalance) {
        this.accountBalance = accountBalance;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getOwnerId() {
        return ownerId == null ? 0 : ownerId;
    }

    public void setOwnerId(Integer ownerId) {
        this.ownerId = ownerId;
    }
}
